package filechat;

import javax.swing.text.DefaultCaret;

public class ChatWindow extends javax.swing.JFrame {

    public ChatWindow() {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ChatWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ChatWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ChatWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ChatWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        
        initComponents();
    }    
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        chatWindowFileChooser = new javax.swing.JFileChooser();
        readScrollPane = new javax.swing.JScrollPane();
        readArea = new javax.swing.JTextArea();
        writeScrollPane = new javax.swing.JScrollPane();
        writeArea = new javax.swing.JTextArea();
        sendButton = new javax.swing.JButton();
        clearButton = new javax.swing.JButton();
        sendFileButton = new javax.swing.JButton();
        chatMenuBar = new javax.swing.JMenuBar();
        chatFileMenu = new javax.swing.JMenu();
        sendFileMenuItem = new javax.swing.JMenuItem();
        saveConversationMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        readArea.setColumns(20);
        readArea.setEditable(false);
        readArea.setRows(5);
        DefaultCaret caret = (DefaultCaret)readArea.getCaret();
        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
        readScrollPane.setViewportView(readArea);

        writeArea.setColumns(20);
        writeArea.setRows(5);
        writeScrollPane.setViewportView(writeArea);

        sendButton.setText("Send");

        clearButton.setText("Clear");

        sendFileButton.setText("Send File");

        chatFileMenu.setText("File");

        sendFileMenuItem.setText("Send a file");
        chatFileMenu.add(sendFileMenuItem);

        saveConversationMenuItem.setText("Save Conversation");
        chatFileMenu.add(saveConversationMenuItem);

        exitMenuItem.setText("Exit");
        chatFileMenu.add(exitMenuItem);

        chatMenuBar.add(chatFileMenu);

        setJMenuBar(chatMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(readScrollPane)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(writeScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(sendButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(clearButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(sendFileButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(readScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 2, Short.MAX_VALUE)
                        .addComponent(sendFileButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(clearButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(sendButton, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(writeScrollPane))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    javax.swing.JMenu chatFileMenu;
    javax.swing.JMenuBar chatMenuBar;
    javax.swing.JFileChooser chatWindowFileChooser;
    javax.swing.JButton clearButton;
    javax.swing.JMenuItem exitMenuItem;
    javax.swing.JTextArea readArea;
    javax.swing.JScrollPane readScrollPane;
    javax.swing.JMenuItem saveConversationMenuItem;
    javax.swing.JButton sendButton;
    javax.swing.JButton sendFileButton;
    javax.swing.JMenuItem sendFileMenuItem;
    javax.swing.JTextArea writeArea;
    javax.swing.JScrollPane writeScrollPane;
    // End of variables declaration//GEN-END:variables
}
